package application;

/***************
 * 
 * This is a singleton class that is used for game
 * Session data such as:
 *   1) List of available games retrieved from the server
 *   3) Player ranking data from the server
 *   4) Game to join - variable is used to store the game
 *      id requested by a player to join
 * 
***************/
import java.util.ArrayList;
import java.util.List;

import javax.net.ssl.SSLSocket;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

public class PreGameScreenSession {
	private static PreGameScreenSession instance = null;
	
	static List<String> myAvailableGames;
	static String requestedGameToJoin;
	public static SSLSocket gameSocket;
	
	static ObservableList<PreGameScreenPlayerRanking> playerStatsData;
	
	public static PreGameScreenSession getInstance(){
		if(instance == null){
			
			instance = new PreGameScreenSession();
			
			// Initialize the requestedGameToJoin
			requestedGameToJoin = null;
			gameSocket = null;

		}
		
		return instance;
	}
	
	private PreGameScreenSession(){
		myAvailableGames = new ArrayList<String>();
		
	}
	
	public static int getListLength()
	{
		return myAvailableGames.size();
	}

	public void printList()
	{
		for (int i=0; i < this.myAvailableGames.size(); i++) {
			String element = this.myAvailableGames.get(i);
			// System.out.println(element);
		}
	}
	
}
